<template>
   <van-form @submit="onSubmit">
  <van-cell-group inset>
    <van-field
     type="password"
      v-model="user.secret_answer"
      name="密保"
      label="密保"
      placeholder="密保"
      :rules="[{ required: true, message: '请填写用户密保' }]"
    />
    <van-field
      v-model="user.password"
      type="password"
      name="密码"
      label="密码"
      placeholder="密码"
      :rules="[{ required: true, message: '请填写密码' }]"
    />
  </van-cell-group>
  <div style="margin: 16px;">
    <van-button round block type="primary" native-type="submit">
      提交
    </van-button>
  </div>
</van-form>
</template>
<script setup>
import {ref,userRouter} from 'vue'
import {changePassword} from '@/api/user'
import { showNotify } from "vant";

let user =ref({
    secret_answer:'',
    password:''
})
let onSubmit= async ()=>{
    let data={
        password:user.value.password,
        secret_answer:user.value.secret_answer
    }
    console.log(data);
      await changePassword(data)
      showNotify({
      type: "success",
      message: "修改成功", 
      duration:1000,
 })


}
</script>